config="InSPO"
agent="sep_mlp"

env_name="bridge"

# h5file_suffix="optimal"
# buffer_size=500 # 500 for optimal and 1000 for mix
h5file_suffix="mix"
buffer_size=1000

batch_size_run=8
batch_size=128

use_gae=True
gae_lambda="0.8"

softmax_temp="100"

IS_ratio_min=0.1
IS_ratio_max=100.0

cql_coeff="0."
alpha="0.1"
entropy_coef_start="0."
entropy_coef_end="0."
lr="0.001"
other_policy_pow=1

q_penalty_coeff="0.7"

seeds=("0" "1" "2" "3" "4")
CUDA_DEVICE=3

for seed in "${seeds[@]}"; do
    current_time=$(date "+%Y.%m.%d-%H.%M.%S")
            
    output_file="output/${env_name}_${h5file_suffix}_${current_time}_${alpha}_${q_penalty_coeff}_${seed}.txt"

    echo "Output to $output_file"

    export CUDA_VISIBLE_DEVICES=$CUDA_DEVICE

    nohup python src/main.py \
        --config=$config --env-config=$env_name with \
        h5file_suffix=$h5file_suffix \
        agent=$agent \
        batch_size_run=$batch_size_run \
        buffer_size=$buffer_size \
        batch_size=$batch_size \
        use_gae=$use_gae \
        gae_lambda=$gae_lambda \
        softmax_temp=$softmax_temp \
        IS_ratio_min=$IS_ratio_min \
        IS_ratio_max=$IS_ratio_max \
        alpha_start=$alpha \
        alpha_end=$alpha \
        entropy_coef_start=$entropy_coef_start \
        entropy_coef_end=$entropy_coef_end \
        actor_lr=$lr \
        critic_lr=$lr \
        q_penalty_coeff=$q_penalty_coeff \
        other_policy_pow=$other_policy_pow \
        seed=$seed > $output_file 2>&1 &

    pid=$!

    echo "Running in the background with PID $pid"

    wait
done
